<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        /* 屏幕最大宽度是800px */
        /* 根据屏幕尺寸改变不同的样式 */
        
        @media screen and (min-width: 320px) {
            body {
                background-color: pink;
                /*超过800像素时就不是该颜色*/
            }
        }
        
        @media screen and (max-width: 1280px) {
            body {
                background-color: purple;
                /*超过500像素时就不是该颜色*/
            }
        }
        /* 适配不同屏幕的大小 */
        
        .top {
            height: 1rem;
            font-size: 0.5rem;
            background-color: palegreen;
            text-align: center;
            line-height: 1rem;
            color: black;
        }
        
        @media screen and (min-width:320px) {
            html {
                font-size: 50px
            }
        }
        
        @media screen and (min-width:640px) {
            html {
                font-size: 100px
            }
        }
    </style>
</head>

<body>
    <div class="top">
        购物车
    </div>
</body>

</html>